class Func {

  getIP(req) {
    return req.get('X-Forwarded-For') || req.ip;
  }

  encodeIp(ip) {
    ip += '';
    ip = ip.split('.');
    const len = ip.length - 1;
    return '*' + ip[len] + '.' + ip[len - 1];
  }

}

module.exports = new Func();